<?php

/**
 * @author Eureka
 */
class Location extends CActiveRecord
{

	public static function model($className = __CLASS__)
	{
		return parent::model($className);
	}

	public function tableName()
	{
		return 'location';
	}

	public function findUsedLocation()
	{
		$criteria = new CDbCriteria();
		$criteria->alias = 'l';
		$criteria->select = 'DISTINCT(l.id), l.name';
		$criteria->join = 'JOIN shop_locations sl ON (sl.location_id = l.id)';
		return $this->findAll($criteria);
	}

}
